package com.ts.animal.domain;

import com.alibaba.fastjson.JSON;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 接收基站发送的原始数据
 *
 * @author bobby
 * @email bobby@126.com
 * @date 2020-06-06 10:36:06
 */
public class BaseStationRevOriginalDataDO implements Serializable {
    private static final long serialVersionUID = 1L;

    //采集基站设备号
    private String no;
    //采集基站设备型号
    private String mod;
    //环境温度
    private Float rtp;
    //湿度
    private Float rh;
    //最初体重 湿度
    private Gps gps;
    //数据
    private String da;
    //数据 转换为数组
    private List<DaArr> daArr;
    //签名时间戳  （毫秒级别）
    private long sgm;
    //由da + no +sgm+ key计算所得
    private String sg;
    //返回码
    private int co = 200;

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }

    public String getMod() {
        return mod;
    }

    public void setMod(String mod) {
        this.mod = mod;
    }

    public Float getRtp() {
        return rtp;
    }

    public void setRtp(Float rtp) {
        this.rtp = rtp;
    }

    public Float getRh() {
        return rh;
    }

    public void setRh(Float rh) {
        this.rh = rh;
    }

    public long getSgm() {
        return sgm;
    }

    public void setSgm(long sgm) {
        this.sgm = sgm;
    }

    public String getSg() {
        return sg;
    }

    public void setSg(String sg) {
        this.sg = sg;
    }

    public int getCo() {
        return co;
    }

    public void setCo(int co) {
        this.co = co;
    }

    public Gps getGps() {
        return gps;
    }

    public void setGps(Gps gps) {
        this.gps = gps;
    }

    public String getDa() {
        return da;
    }

    public void setDa(String da) {
        this.da = da;
        setDaArr(JSON.parseArray(da, DaArr.class));
    }

    public List<DaArr> getDaArr() {
        return daArr;
    }

    public void setDaArr(List<DaArr> daArr) {
        this.daArr = daArr;
    }

    public static class DaArr implements Serializable {

        //耳标序列号
        private String eno;
        //体温温度
        private Float tp;
        //电量
        private int elec;
        //采集时间戳
        private Long tm;
        //采集时间
        private Date ct;
        //运动量
        private String sp;
        //信号量
        private String rssi;

        public String getEno() {
            return eno;
        }

        public void setEno(String eno) {
            this.eno = eno;
        }

        public Float getTp() {
            return tp;
        }

        public void setTp(Float tp) {
            this.tp = tp;
        }

        public int getElec() {
            return elec;
        }

        public void setElec(int elec) {
            this.elec = elec;
        }

        public Long getTm() {
            return tm;
        }

        public void setTm(Long tm) {
            this.tm = tm;
            setCt(new Date(tm * 1000));
        }

        public Date getCt() {
            return ct;
        }

        public void setCt(Date ct) {
            this.ct = ct;
        }

        public String getSp() {
            return sp;
        }

        public void setSp(String sp) {
            this.sp = sp;
        }

        public String getRssi() {
            return rssi;
        }

        public void setRssi(String rssi) {
            this.rssi = rssi;
        }
    }

    public static class Gps implements Serializable {
        //经度
        private Double w;
        //南北纬
        private String ns;
        //纬度
        private Double s;
        //东西经
        private String ew;

        public Double getW() {
            return w;
        }

        public void setW(Double w) {
            this.w = w;
        }

        public String getNs() {
            return ns;
        }

        public void setNs(String ns) {
            this.ns = ns;
        }

        public Double getS() {
            return s;
        }

        public void setS(Double s) {
            this.s = s;
        }

        public String getEw() {
            return ew;
        }

        public void setEw(String ew) {
            this.ew = ew;
        }

    }
}
